Release 10.1A: OpenEdge Development:
Progress 4GL Reference
RETURN statement
Leaves the local or remote procedure block and returns to the calling procedure. If there is no calling procedure, RETURN returns to the Procedure Editor or other ADE tool that invoked the procedure.
For more information on remote procedures, see OpenEdge Application Server: Developing AppServer Applications .
Syntax
ERRORCauses an ERROR condition in the calling block. This causes the ERROR condition to be raised for the RUN statement in the calling procedure. You can use the ERROR option only in a procedure or a database trigger block. Any values that are set for OUTPUT or INPUT-OUTPUT parameters before the RETURN ERROR executes are not returned to the calling procedure.
NO-APPLYSuppresses the default behavior for the current user-interface event. For example, the default behavior for a character code key press in a fill-in field is to echo the character in the field. If you execute RETURN NO-APPLY in a trigger, this behavior is not performed. You can use the NO-APPLY option in a user-interface trigger block or within an internal procedure.
return-valueThe value that RETURN returns to the calling procedure. RETURN appearing in a user-defined function returns an expression whose type matches the return type of the function. RETURN not appearing in a user-defined function returns a CHARACTER expression. To access
Examplesreturn-valuefrom the calling procedure, use the RETURN-VALUE function.The
r-fact.pprocedure is called recursively because (nfactorial) isn* ((n- 1) factorial). Ther-fact.pprocedure first checks that the input value is valid. If the value is invalid, it returns a message to the caller. Note thatr-return.pchecks the RETURN-VALUE immediately after runningr-fact.p. If a message is returned,r-return.pdisplays that message.The procedure
r-return.paccepts an integer as input and then runsr-fact.pto calculate the factorial of that integer. The factorial of a number is the result of multiplying together all of the integers less than or equal to that number (for example: 3 factorial is 3 * 2 * 1 = 6). Ther-fact.pprocedure is called recursively becausenfactorial isn* (n-1) factorial.
Note that this is not the most efficient way to calculate factorials, but in other applications, such as bill of material explosions, recursive procedures are very effective.
Notes
- The RETURN-VALUE function provides the value returned by the most recently executed RETURN statement of a local or remote procedure.
- If the procedure executing the RETURN statement is called asynchronously, the client can access the return value and ERROR condition in the associated event procedure. For more information on event procedures, see OpenEdge Application Server: Developing AppServer Applications .
See also
CREATE SAX-READER statement, FUNCTION statement, ON ENDKEY phrase, ON ERROR phrase, ON QUIT phrase, ON STOP phrase, RETURN-VALUE function
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |